package router

import (
	"awesomeProject/middleware"
	"awesomeProject/web"
	"github.com/gin-gonic/gin"
)

func Initcourse(r *gin.Engine) {
	//不同分组设置权限检查
	course := r.Group("/course", middleware.TokenCheck())
	v1 := course.Group("/v1")
	//登录检查接口
	//http://localhost:3013/course/v1/detail/
	v1.GET("/detail/:id", web.GetCourseDetail) //处理函数
	v1.GET("/view/:id", web.GetCourseVideo)    //

	//权限检查 路由分组
	admin := course.Group("/admin", middleware.AuthCheck)
	adminV1 := admin.Group("/V1")
	adminV1.POST("/add", web.AddCourse)
	adminV1.POST("/publish", web.PublishCourse)
	adminV1.POST("/upload", web.UploadCourse)
}
